package com.tiancheng.trade.settlement.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * 分页信息
 */
@Data
public class BasePage {
    @JsonProperty("current_page")
    private Integer currentPage;

    @JsonProperty("page_size")
    private Integer pageSize;

    /**
     * 开始记录
     */
    private Integer start;

    public Integer getCurrentPage() {
        if (null == currentPage || currentPage < 0) {
            currentPage = 1;
        }
        return currentPage;
    }

    public Integer getPageSize() {
        if (null == pageSize) {
            pageSize = 20;
        }
        return pageSize;
    }
    public void buildStart(){
        this.setStart((this.getCurrentPage()-1)*this.getPageSize());
    }
}
